package main

import (
	"MessageSendService/app/api/etc"
	"MessageSendService/app/api/internal/db"
	"MessageSendService/app/api/internal/mq"
	"MessageSendService/app/api/internal/router"
	"MessageSendService/app/api/rpc"
	"MessageSendService/app/common/log"
	"MessageSendService/app/common/models/accounts"
	"fmt"
	"go.uber.org/zap"
)

//var configPath = "./app/api/api.yml"
//var logPath = "./app/api/logs/"

var logPath = "./logs/"
var configPath = "./api.yml"

// @title 消息推送平台。
// @version 1.0
// @description 消息推送平台，供Web 端调用。
// @host 127.0.0.1:8088
// @basePath /
// @accept json
// @produce json
func main() {
	var err error
	//加载配置文件
	etc.LoadConfig(configPath)

	//初始化日志
	log.InitLogger(logPath)
	log.GetLogger().Info("fdasf", zap.Bool("asdf", true))

	//初始化数据库连接
	db.MysqlConnectInit()

	//初始化kafka链接
	mq.Init()

	go rpc.InitGRPC()

	accountZao := accounts.TencentSmsAccount{
		Url:          "",
		SupplierName: "tencent",
		SmsSdkAppId:  "1400671965",
		SignName:     "荆轲爱学习公众号",
		SupplierId:   1,
		Region:       "ap-shanghai",
		TemplateId:   "2243375",
	}
	fmt.Println("-----------", accountZao)

	err = router.Router().Run(":" + etc.Config.Port)
	if err != nil {
		panic(err)
	}
}
